import React,{Component} from "react";
import {Redirect} from "react-router-dom";
import { matchPath } from "react-router";

export default class UserDetail extends Component<any, any>{

    // auth = false;
    //
    // render() {
    //     if (!this.auth){
    //         return (
    //           <Redirect to={"/login/"} from={"/user/detail"} />
    //         )
    //     }
    //     return (
    //         <div>
    //             userDetail router
    //         </div>
    //     )
    // }

    componentDidMount(): void {
        /**
         * 路由的匹配
         */
        const match = matchPath("/user/detail/1", {
            path: "/user/detail/:id",
            exact: true,
            /**
             * 严格匹配
             */
            strict:true
        });
        console.log(match)
    }

    render() {
        return (
            <div>
                user detail
            </div>
        )
    }
}
